﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using AopTest.test;
using autofac.test.aop;
using autofac.test.Extend;
using Autofac.Extras.DynamicProxy;
using Core.InterFace.Interface;
using Microsoft.AspNetCore.Mvc;

namespace autofac.test.Controllers
{
    [Route("api/[controller]")]
    [Intercept(typeof(AOPTest))]
    public class ValuesController : Controller
    {

        public IMessageService service { get; set; } //属性注入 不可以写成字段。 而且应该是  public

        public IA _iA { get; set; }

        public ValuesController(IA iA)
        {
            _iA = iA;
        } 


        // GET api/values
        [HttpGet]
        public IEnumerable<string> Get()
        {
            var sst = _iA.Show(2, "ccc");
            service.GetMessage("sss");
            return new string[] { "value1", "value2" };
        }

        // GET api/values/5
        [HttpGet("{id}")]
        public string Get(int id)
        {
           
            return "value";
        }

        // POST api/values
        [HttpPost]
        public void Post([FromBody]string value)
        {
        }

        // PUT api/values/5
        [HttpPut("{id}")]
        public void Put(int id, [FromBody]string value)
        {
        }

        // DELETE api/values/5
        [HttpDelete("{id}")]
        public void Delete(int id)
        {
        }
    }
}
